package com.teziyou.commodity.util;

import java.lang.reflect.Field;
import java.util.Map;

@SuppressWarnings("rawtypes")
public class Beans {
	
	private Map map;
	
	public Beans(Map map) {
		this.map = map;
	}
	
	public Object fillBean(Object obj) {
		Class objclass = obj.getClass();
		Field[] fields = objclass.getFields();
		for(Field field:fields) {
			String name = field.getName();
			if(!"metaDataMap".equals(name)) {
				try {
					field.set(obj, map.get(field.getName()));
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		}
		return obj;
	}

}
